import axios from "axios";

const getNews = {
    namespaced:true,
    state:{
        allNews:{},
    },
    actions:{
        async cover(context,allNews){
            console.log('.......>>>>>>',allNews);
            try {
                const allBooks = await coverRequest(allbooksPage);
                console.log('allBooks',allBooks.data)
                context.commit('setBooks',{'books':allBooks.data,'total':allBooks.num})
            }catch (error){
                console.log('Error3',error);
            }
        }
    },
    mutations:{
        setBooks(state,data){
            console.log('-0-0',data);
            state.allBooks = data.books
            state.total = data.total
        }
    },
    getters:{
        getBooks(state){
            return state.allBooks
        },
        getTotal(state){
            return state.total
        },
    },
}
export default getNews